<?php

class Application_Form_SpekgensetForm extends Zend_Form
{   
    
    private function getDaya()
    {
        $daya = new Application_Model_HargaSewa();
        $result = $daya->getDataDaya();
        $dayaKva = array();
        
        foreach ($result as $result)
        {
            $dayaKva[] = (string)$result['daya_kva'];
        }
        
        return $dayaKva;
    }
    
    public function init()
    {
        $id = new Zend_Form_Element_Hidden('id_engine_genset');
        
        $genset_model = new Zend_Form_Element_Text('genset_model');
        $genset_model->setLabel('Genset Model')->setRequired();
        
        $engine_type = new Zend_Form_Element_Text('engine_type');
        $engine_type->setLabel('Engine Type')->setRequired();
        
        $engine_model = new Zend_Form_Element_Text('engine_model');
        $engine_model->setLabel('Engine Model')->setRequired();
        
        $daya_kva = new ZendX_JQuery_Form_Element_AutoComplete('daya_kva');
        $daya_kva->setLabel('Kva')->setRequired()->setJQueryParams(array('source' => $this->getDaya()));
        
        $daya_kw = new Zend_Form_Element_Text('daya_kw');
        $daya_kw->setLabel('KW')->setRequired();
        
        $silinder = new Zend_Form_Element_Text('no_silinder');
        $silinder->setLabel('No. of Cylinder')->setRequired();
        
        $stack = new Zend_Form_Element_Text('no_stack');
        $stack->setLabel('No. of Stack')->setRequired();
        
        $bore_x_stroke = new Zend_Form_Element_Text('bore_x_stroke');
        $bore_x_stroke->setLabel('Bore X Stroke')->setRequired();
        
        $piston_display = new Zend_Form_Element_Text('piston_display');
        $piston_display->setLabel('Piston Display')->setRequired();
        
        $fuel_consumption = new Zend_Form_Element_Text('fuel_consumption');
        $fuel_consumption->setLabel('Fuel Consumption')->setRequired();
        
        $oil_capacity = new Zend_Form_Element_Text('oil_capacity');
        $oil_capacity->setLabel('Oil Capacity')->setRequired();
        
        $length = new Zend_Form_Element_Text('length');
        $length->setLabel('Length')->setRequired();
        
        $width = new Zend_Form_Element_Text('width');
        $width->setLabel('Width')->setRequired();
        
        $height = new Zend_Form_Element_Text('height');
        $height->setLabel('Height')->setRequired();
        
        $weight = new Zend_Form_Element_Text('weight');
        $weight->setLabel('Weight')->setRequired();
        
        $fuel_tank_capacity = new Zend_Form_Element_Text('fuel_tank_capacity');
        $fuel_tank_capacity->setLabel('Fuel Tank Capacity');
        
        $jam_operasi = new Zend_Form_Element_Text('jam_operasi');
        $jam_operasi->setLabel('Operation Time');
        
        $this->addElements(array($genset_model, $engine_type, $engine_model, $daya_kva, $daya_kw, $silinder,
                                $stack, $bore_x_stroke, $piston_display, $fuel_consumption, $oil_capacity,
                                $length, $width, $height, $weight, $fuel_tank_capacity, $jam_operasi, $id));
    }


}

